﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Layout.Master" AutoEventWireup="true" CodeBehind="wfSMSByOutlet.aspx.cs" Inherits="Dragon.wfSMSByOutlet" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">    
    <table class="auto-style9" style="border-color: #666633; width:100%">        
        <tr>
            <td class="auto-style5" style="width: 6%; color: #000080;padding-left:5px;">
                Tháng 
            </td>
            <td class="auto-style6" style="width: 8%;">
                <asp:DropDownList ID="ddlMonth" runat="server" Width="90%" ForeColor="#000099">
                    <asp:ListItem>01</asp:ListItem>
                    <asp:ListItem>02</asp:ListItem>
                    <asp:ListItem>03</asp:ListItem>
                    <asp:ListItem>04</asp:ListItem>
                    <asp:ListItem>05</asp:ListItem>
                    <asp:ListItem>06</asp:ListItem>
                    <asp:ListItem>07</asp:ListItem>
                    <asp:ListItem>08</asp:ListItem>
                    <asp:ListItem>09</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
                    <asp:ListItem>11</asp:ListItem>
                    <asp:ListItem>12</asp:ListItem>
                </asp:DropDownList>                            
            </td>
            <td class="auto-style5" style="width: 6%; color: #000080;padding-left:5px;">
                Năm 
            </td>
            <td class="auto-style6" style="width: 8%;">
                <asp:DropDownList ID="ddlYear" runat="server" Width="90%" ForeColor="#000099">
                    <asp:ListItem>2015</asp:ListItem>
                    <asp:ListItem>2016</asp:ListItem>
                    <asp:ListItem>2017</asp:ListItem>
                    <asp:ListItem>2018</asp:ListItem>
                    <asp:ListItem>2019</asp:ListItem>
                    <asp:ListItem>2020</asp:ListItem>
                </asp:DropDownList>                            
            </td>
            <td class="auto-style5" style="width: 8%; color: #000080;padding-left:5px;">
                Tỉnh thành 
            </td>
            <td class="auto-style6" style="width: 15%;">
                <asp:DropDownList ID="ddlProvince" runat="server" Width="90%" ForeColor="#000099" AutoPostBack="True" DataSourceID="SqlDataSource2" DataTextField="Name" DataValueField="Code" OnDataBound="ddlProvince_DataBound">
                </asp:DropDownList>                            
            </td>
            <td class="auto-style5" style="width: 10%; color: #000080;padding-left:5px;">
                Nhà phân phối
            </td>
            <td class="auto-style6" style="width: 35%;">
                <asp:DropDownList ID="ddlDistributor" runat="server" Width="90%" ForeColor="#000099" DataSourceID="SqlDataSource3" DataTextField="Name" DataValueField="Code" OnDataBound="ddlDistributor_DataBound">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="auto-style5" style="width: 6%; color: #000080;padding-left:5px;">
                SR
            </td>
            <td class="auto-style6" style="width: 22%;"colspan="3">
                <asp:DropDownList ID="ddlSR" runat="server" Width="95%" ForeColor="#000099" DataSourceID="SqlDataSource4" DataTextField="Fullname" DataValueField="Username" OnDataBound="ddlSR_DataBound">
                </asp:DropDownList>
            </td>
            <td class="auto-style6" style="width: 10%;text-align:center"colspan="2">
                <asp:Button ID="btnReport" runat="server" Text="Xem báo cáo" ForeColor="#000099" style="text-align: center; font-weight: 700;" OnClick="btnReport_Click" />
            </td>
        </tr>
        <tr>
            <td class="auto-style4" colspan="8">                
                <rsweb:ReportViewer ID="rpSMSByOutlet" runat="server" Width="100%" Height="570px" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" ZoomMode="PageWidth">        
                    <LocalReport ReportPath="Report\rpSMSByOutlet.rdlc" ReportEmbeddedResource="Dragon.Report.rpSMSByOutlet.rdlc">
                            <DataSources>
                                <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="dsSMSByOutlet" />
                            </DataSources>
                        </LocalReport>
                </rsweb:ReportViewer>   
            </td>
        </tr>
    </table>    
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CarlsbergConnectionString %>" SelectCommand="sp_Display_SMS_By_Outlet" SelectCommandType="StoredProcedure"></asp:SqlDataSource>      
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:CarlsbergConnectionString %>" SelectCommand="SELECT * FROM [Province] WHERE ([Status] = @Status)">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="Status" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:CarlsbergConnectionString %>" SelectCommand="SELECT * FROM [Distributor] WHERE ([Province] = @Province)">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlProvince" Name="Province" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:CarlsbergConnectionString %>" 
        SelectCommand="SELECT [User].Username, [User].Fullname, [User].UserType FROM Province INNER JOIN Region ON Province.Code = Region.Province 
        INNER JOIN [User] ON Region.Code = [User].Region WHERE (Province.Code = @Province) AND ([User].UserType = N'SR') ORDER BY [User].Fullname">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlProvince" Name="Province" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    </asp:Content>
